package com.king.service.impl;

import com.king.entity.User;
import com.king.service.UserService;
import org.springframework.stereotype.Service;

import java.util.Random;
import java.util.UUID;

/**
 * @packageNme com.king.service.impl
 * @Author: jinguoguang
 * @Date: 2024/5/27 15:20
 * @Version: v1.0.0
 **/
@Service
public class UserServiceImpl implements UserService {
    @Override
    public User updateUser(User user) {
        System.out.println("更新用户id:"+user.getId());
        return user;
    }

    @Override
    public String deleteUser(String id) {
        System.out.println("删除用户id:"+id);
        return id;
    }

    @Override
    public User addUser(User user) {
        user.setId(UUID.randomUUID().toString());
        user.setAge(new Random().nextInt(100));
        user.setName("张三");
        user.setAddress("北京");
        return user;
    }

    @Override
    public User getUserById(String id) {
       User user= User.builder()
                .id(id)
                .name("张三")
                .age(18)
                .address("北京")
                .build();
        return user;
    }


}
